#include "../include/double_Sql_list.h"
#include "../include/file.h"
#include "../include/log_in.h"

Log_in_data data[3] = 
{
 { .name = "刘备" , .password = "123" ,  .id = 0  },
 { .name = "关羽" , .password = "123" ,  .id = 0  },
 { .name = "张飞" , .password = "123" ,  .id = 0  }
};

void test_2(void)
{
    Double_Link_List * list = init_double_link_list();

    // 插入数据
    insert_double_node( list , data[0] , 1 );
    insert_double_node( list , data[1] , 2 );
    insert_double_node( list , data[2] , 3 );

    // 修改
    root_amend( list , "刘备" );
    
    // 遍历 
    print_forward_double_link_list(list);
    
    // 释放空间
    free_double_link_list(&list);
}

int main(int argc, char const *argv[])
{
    test_2();
    
    return 0;
}

void test_1(void)
{
    // 对链表进行初始化
    Double_Link_List * dom_list = init_double_link_list();  // 普通用户 
    Double_Link_List * root_list = init_double_link_list(); // 管理员用户

    // 数据的载入
    F_scanf( dom_list , "2_dom_data.txt" );
    F_scanf( root_list , "1_root_data.txt" );
    
    int num = 0;
    printf("1:进入登陆\t 2:进入注册");
    scanf("%d" , &num);

    switch (num)
    {
    case 1:
        log_in( dom_list , root_list );
        break;
    case 2:
        reg( dom_list );
        break;
    default:
        break;
    }
    
    // 释放链表
    free_double_link_list(&dom_list);
    free_double_link_list(&root_list);

}

